package zj.it.bhne.gridengineeringsurvey.myutils;

import org.dom4j.DocumentException;

/**
 * Created by Jiang on 2019/1/30
 */
public class XmlParse {


    private static String projectid;

    public static void parseXMLPull(String str) throws DocumentException {
        /*Document doc=(Document) DocumentHelper.parseText(str);
        Element projects = doc.getRootElement();
        Iterator Elements = projects.elementIterator();
        while(Elements.hasNext()){
            Element pl = (Element)Elements.next();
            if(pl.getName().equals("ProjectId")){
                projectid= pl.getText();
            }else if(pl.getName().equals("Point")){
                List attrList = pl.attributes();
                Map<String, Object> pointmap=new HashMap<String, Object>();
                for (int i = 0; i < attrList.size(); i++) {
                    //Point属性的取得
                    Attribute item = (Attribute)attrList.get(i);
                    pointmap.put(item.getName(), item.getValue());
                }
                pointlist.add(pointmap);
                Iterator Elementspl = pl.elementIterator();
                while(Elementspl.hasNext()){
                    Element point = (Element)Elementspl.next();
                    //Point子节点属性的取得
                    if(point.getName().equals("ColumnModel")){
                        List ColumnModel = point.attributes();
                        Map<String, Object> columnModelmap=new HashMap<String, Object>();
                        for (int i = 0; i < ColumnModel.size(); i++) {
                            Attribute item = (Attribute)ColumnModel.get(i);
                            columnModelmap.put(item.getName(), item.getValue());
                        }
                        columnModellist.add(columnModelmap);
                    }else if(point.getName().equals("PointModel")){
                        List ColumnModel = point.attributes();
                        Map<String, Object> pointModelmap=new HashMap<String, Object>();
                        for (int i = 0; i < ColumnModel.size(); i++) {
                            Attribute item = (Attribute)ColumnModel.get(i);
                            pointModelmap.put(item.getName(), item.getValue());
                        }
                        pointModellist.add(pointModelmap);
                    }else if(point.getName().equals("Multimedia")){
                        List ColumnModel = point.attributes();
                        Map<String, Object> multimediamap=new HashMap<String, Object>();
                        for (int i = 0; i < ColumnModel.size(); i++) {
                            Attribute item = (Attribute)ColumnModel.get(i);
                            multimediamap.put(item.getName(), item.getValue());
                        }
                        multimedialist.add(multimediamap);
                    }
                }
            }else if(pl.getName().equals("Line")){
                List lineList = pl.attributes();
                Map<String, Object> linemap=new HashMap<String, Object>();
                for (int i = 0; i < lineList.size(); i++) {
                    //line属性的取得
                    Attribute item = (Attribute)lineList.get(i);
                    linemap.put(item.getName(), item.getValue());
                }
                linelist.add(linemap);
                Iterator Elementlinez = pl.elementIterator();
                while(Elementlinez.hasNext()){
                    Element line = (Element)Elementlinez.next();
                    //Line子节点属性的取得
                    if(line.getName().equals("LineModel")){
                        List lineModel = line.attributes();
                        for (int i = 0; i < lineModel.size(); i++) {
                            Attribute item = (Attribute)lineModel.get(i);
                            lineModelmap.put(item.getName(), item.getValue());
                        }
                    }
                }
            }
        }*/
    }
}
